package com.itheima.web.controller;

import com.itheima.web.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AnalysisController {

    @Autowired
    AnalysisManager analysisManager;

    @GetMapping("/dashboard/summary")
    public ResponseEntity findSummary(){
        return analysisManager.findSummary();
    }

    @GetMapping("/dashboard/users")
    public ResponseEntity findData(
            @RequestParam(value = "sd") Long start,
            @RequestParam(value = "ed") Long end,
            String type
    ){
        return analysisManager.findData(start, end, type);
    }
}
